package db

import (
	"catering_sys_api/core/conf"
	"context"
	"github.com/redis/go-redis/v9"
)

var Reids *redis.Client

func InitRedis(c conf.Redis) {

	client := redis.NewClient(&redis.Options{
		Addr:     c.Address,
		Password: c.Password, // no password set
		DB:       c.DB,       // use default DB
	})
	_, err := client.Ping(context.Background()).Result()
	if err != nil {
		panic(err.Error())
	}
	Reids = client
}
